var app = getApp()
Page({
  data:{
    url:{
      saveData: app.url.baseUrl +"/my/escAppointment",
    },
    aid : "",
    text: ''
  },
  onLoad: function (o) {
    console.log(o.aid);
    this.setData({aid : o.aid})
  },
  saveData: function () {
    var utext = this.data.text;
    if(utext.length <=0){
      wx.showToast({
        title: '请填写取消理由',
      })
      return
    }
    var data = { id: this.data.aid, userEscReason: utext}
    app.ajax(this.data.url.saveData,data,function(res){
      var data = res.data
      if(data.code != 2000){
        wx.showToast({
          title: '预约已更改请刷新页面',
        })
        return;
      }
      wx.showModal({
        content: '提交成功',
        showCancel:false,
        success:function(){
          wx.navigateBack({})
        }
      })
    })
  },
  bindTextAreaBlur : function(e){
    var t = e.detail.value;
    this.setData({text : t})
  }
})

